<style>
    #dict-update {
        padding: 20px 25px 25px 0;
    }

    #dict-update .layui-treeSelect .ztree li a, .ztree li span {
        margin: 0 0 2px 3px !important;
    }
</style>
<div class="layui-fluid" id="dict-update">
    <form class="layui-form" action="" lay-filter="dict-update-form">
                <div class="layui-form-item zzdz-hide ">
                    <label class="layui-form-label zzdz-form-item-require">主键：</label>
                    <div class="layui-input-block">
                        <input type="text" name="id" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label zzdz-form-item-require">字典类型：</label>
                    <div class="layui-input-block">
                        <input type="text" name="type" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label zzdz-form-item">描述：</label>
                    <div class="layui-input-block">
                        <input type="text" name="description" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label zzdz-form-item">备注：</label>
                    <div class="layui-input-block">
                        <input type="text" name="remarks" autocomplete="off" class="layui-input">
                    </div>
                </div>
        <div class="layui-form-item zzdz-hide">
            <button class="layui-btn" lay-submit="" lay-filter="dict-update-form-submit" id="submit"></button>
        </div>
    </form>
</div>

<script data-th-inline="javascript">
    layui.use(['zzdz', 'form'], function () {
        var $ = layui.$,
            zzdz = layui.zzdz,
            layer = layui.layer,
            form = layui.form,
            dict = [[${dict}]];
        form.render();

        initDictValue();

        function initDictValue() {
            form.val("dict-update-form", {
                    "id":dict.id,
                    "type":dict.type,
                    "description":dict.description,
                    "remarks":dict.remarks,
                    "createTime":dict.createTime,
                    "updateTime":dict.updateTime,
            });
        }

        form.on('submit(dict-update-form-submit)', function (data) {
            if (zzdz.nativeEqual(data.field, dict)) {
                zzdz.alert.warn('数据未作任何修改！');
                return false;
            }
            zzdz.post(ctx + 'dict/update', data.field, function () {
                layer.closeAll();
                zzdz.alert.success(dict.type + ' 字典表数据修改成功');
                $('#zzdz-dict').find('#query').click();
            });
            return false;
        });
    });
</script>